<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>层次选择器</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <script language="JavaScript" src="../js/jquery-3.3.1.min.js"></script>
    <style type="text/css">
        div {
            width: 180px;
            height: 50px;
            background: white;
            border: red 1px solid;
        }
    </style>

</head>

<body>

<input type="button" value="改变第一个div元素的背景色为 红色" id="b1"/>
<br><br>

<div>我是div</div>
<div id="div1" class="马云">我是div1 马云</div>
<div id="div2" class="马化腾">我是div2 马化腾</div>
<div id="div3" class="小马哥">我是div3 小马哥</div>
<div id="div4" class="老马">我是div4 老马</div>
<div id="div5" class="div5">我是div5</div>

</body>

<script type="text/javascript">
    $("#b1").click(function () {
        $("div:last").css("background-color", "red");
    });
</script>
</html>